package cn.fly.Util.thread;

/**
 * @author mifei
 * @create 2018年05月03日
 **/
public class MyTask implements Runnable,ThreadMessage {
    private int taskNum;

    public MyTask(int num) {
        this.taskNum = num;
    }

    @Override
    public void run() {
        System.out.println("正在执行task "+taskNum);
        int i=4/0;
        try {
            Thread.currentThread().sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("task "+taskNum+"执行完毕");
    }

    public int getTaskNum() {
        return taskNum;
    }

    public void setTaskNum(int taskNum) {
        this.taskNum = taskNum;
    }

    @Override
    public String getMessage() {
        return taskNum+"这个出错了";
    }
}